package main

import (
	"fmt"
	"time"
)

func main() {
	tick := time.Tick(1000 * time.Millisecond)
	// boom := time.After(100 * time.Millisecond)
	quit := make(chan int)
	go func() {
		time.Sleep(time.Second * 10)
		quit <- 0
	}()

	for {
		select {
		case <-tick:
			fmt.Println("tick.")
		case <-time.After(1000 * time.Millisecond):
			fmt.Println("BOOM!")
		case <-quit:
			return
			// default:
			// 	fmt.Println("    .")
			// 	time.Sleep(50 * time.Millisecond)
		}
	}
}
